package com.health.mapper;

import com.health.entity.TPermision;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.health.entity.pojo.vo.TPermisionVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author sanchuan
 * @since 2023-04-19
 */
public interface TPermisionMapper extends BaseMapper<TPermision> {
    Set<String> findPermissionsByAccount(String username);

    @Select("SELECT id,title FROM `t_permision` WHERE parent_id = 0")
    List<TPermisionVO> listPermision();

    @Select("SELECT id,title FROM `t_permision` WHERE id = #{id} OR parent_id = #{id}")
    List<TPermisionVO> listSubPermision(Integer id);

    List<Integer> listPermissionsByID(Integer id);
}
